﻿package com.firewolf.command.macrocommand;
public class ComplexRemoteControlTestMain {
	public static void main(String[] args) {
		//创建一些接收者
		Light light = new Light();
		TV tv = new TV();
		Wash wash = new Wash();
		
		//创建一些命令
		LightOnCommand lightOn = new LightOnCommand(light);
		LightOffCommand lightOff = new LightOffCommand(light);
		TvOnCommand tvOn = new TvOnCommand(tv);
		TvOffCommand tvOff = new TvOffCommand(tv);
		WashOnCommand washOn = new WashOnCommand(wash);
		WashOffCommand washOff = new WashOffCommand(wash);
		
		Command[] onCommands = {lightOn,tvOn,washOn};
		Command[] offCommands = {lightOff,tvOff,washOff};
		//创建宏命令
		MacroCommand macroOnCommand = new MacroCommand(onCommands);
		MacroCommand macroOffCommand = new MacroCommand(offCommands);
		ComplexRemoteControl remoteControl = new ComplexRemoteControl();
		remoteControl.setCommand(macroOnCommand, macroOffCommand);
		System.out.println("turn on Command:  ");
		remoteControl.onButtonWasPressed();
		
		System.out.println("\n--------------------------------\n");
		System.out.println("turn off Command:   ");
		remoteControl.offButtonWasPressed();
	}
}
